package com.app.micaihu.view.main.mine.fragment;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.app.micaihu.R;
import com.app.micaihu.app.AppApplication;
import com.app.micaihu.base.AppBaseAdapter;
import com.app.micaihu.bean.infor.UserInfor;
import com.app.micaihu.bean.infor.UserTask;
import com.app.micaihu.bean.message.MineSetList;
import com.app.micaihu.bean.news.ViewNewsSmallImg;
import com.app.micaihu.bean.topic.PostItemBean;
import com.app.micaihu.configure.TypeConstant;
import com.app.micaihu.manager.UserInforManager;
import com.app.micaihu.utils.InteractiveUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.StringUtils;


import java.util.List;

/**
 * Created by Guo on 2017/3/17.
 */

public class MineFragmentAdapter extends AppBaseAdapter<MineSetList> {
    public MineFragmentAdapter(List<MineSetList> list, Context context) {
        super(list, context);
    }

    @Override
    public View creatView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder = null;
        if (convertView == null) {
            viewHolder = new ViewHolder();
            convertView = inflater.inflate(R.layout.item_mine_fragment, null);
            viewHolder.image = convertView.findViewById(R.id.iv_icon);
            viewHolder.str = convertView.findViewById(R.id.str);
            viewHolder.line = convertView.findViewById(R.id.bottom_line);
            viewHolder.redDot = convertView.findViewById(R.id.reddot);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        viewHolder.image.setImageResource(list.get(position).getItemDrawableId());
        viewHolder.str.setText(list.get(position).getItemString());
        LogUtils.e("setHonourMsg", list.get(position));
        if (list.get(position).getItemRedDot()>0) {
            viewHolder.redDot.setVisibility(View.VISIBLE);
        } else {
            viewHolder.redDot.setVisibility(View.GONE);
        }
        return convertView;
    }

    static class ViewHolder {
        ImageView image;
        TextView str;
        View line;
        View redDot;
    }

}
